<%--
  Created by IntelliJ IDEA.
  User: 娅娅
  Date: 2021/9/3
  Time: 14:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
  <head>
    <title></title>
  </head>
  <body>
  <h2 align="center">在线通讯录</h2>
  <form method="post" action="${pageContext.request.contextPath}/contact/list">
    <table align="center">
      <tr>
        <td align="center">
          查找联系人：<input type="text" name="cname" value="${cname}"><input type="submit" value="查找">&nbsp;&nbsp;
          <a href="${pageContext.request.contextPath}/contact/toAdd">添加联系人</a>
        </td>
      </tr>
      <tr>
        <td align="center"><strong>${error}</strong></td>
      </tr>
    </table>
  </form>
  <table align="center">
      <tr style="background: antiquewhite">
        <th align="center">序号</th>
        <th align="center">姓名</th>
        <th align="center">手机</th>
        <th align="center"QQ</th>
        <th align="center">Email</th>
        <th align="center">地址</th>
      </tr>
      <c:forEach var="contact" items="${list}" varStatus="c">
        <tr>
          <td align="center">${contact.id}</td>
          <td align="center"><a href="${pageContext.request.contextPath}/contact/byId?id=${contact.id}">${contact.cname}</a></td>
          <td align="center">${contact.mobile}</td>
          <td align="center">${contact.qq}</td>
          <td align="center">${contact.email}</td>
          <td align="center">${contact.address}</td>
        </tr>
      </c:forEach>
      <tr>
        <td colspan="6" align="center">
          <a href="${pageContext.request.contextPath}/contact/list?currentPageNo=1">首页</a>
          <a href="${pageContext.request.contextPath}/contact/list?currentPageNo=${currentPageNo-1}">上一页</a>
          <a href="${pageContext.request.contextPath}/contact/list?currentPageNo=${currentPageNo+1}">下一页</a>
          <a href="${pageContext.request.contextPath}/contact/list?currentPageNo=${totalPageCount}">末页</a>
          ${currentPageNo}页/共${totalPageCount}页
        </td>
      </tr>
    </table>
  </body>
</html>
